<?php
/**
 * 用户信息插件demon
 *
 * @copyright	http://www.easymvc.com
 * @author 		光哥  <439884988@qq.com>
 * @version		1.0 - 2012-03-26
 * @package		Plugin
 *
 */
class Demo_Plugin_User {
	/**
	 * 运行
	 */
	public function run(){
		$need_login = '';
		if(property_exists(Frame_Dispatcher::$control_obj,'need_login')){
			$need_login = Frame_Dispatcher::$control_obj->need_login;
		}
		
		if($need_login){
			$uid = 1;
			$uname = "easymvc";
			
			//必须登录
			if(!$uid &&  $need_login == 1) {
				if(isset($_SERVER["HTTP_X_REQUESTED_WITH"]) && $_SERVER["HTTP_X_REQUESTED_WITH"]=="XMLHttpRequest"){
					Frame_Dispatcher::$control_obj->showAjax(6,'请登录系统！');
				}else{
					Frame_Dispatcher::$control_obj->showMessage("请登录系统！");
				}
			}
		}else{ //不需要登录
			//echo "no_need_login";
		}
	}
}
?>